package edu.jhu.cs.oose.scheduleit.dao;

import java.util.List;

import edu.jhu.cs.oose.scheduleit.util.Filter;
import edu.jhu.cs.oose.scheduleit.util.ScheduleType;
import edu.jhu.cs.oose.scheduleit.vo.Event;
import edu.jhu.cs.oose.scheduleit.vo.Schedule;
import edu.jhu.cs.oose.scheduleit.vo.User;
/**
 * The DAO class for Schdule VO object.
 * @author oosegroup2
 *
 */
public interface ScheduleDao {
	/**
	 * Responsible for save an schedule object into the database
	 * @param schedule the schedule object to be saved
	 */
	public void save(Schedule schedule);
	/**
	 * Get a list of the schedule by assigning the type from the user. 
	 * By assigning offset and limit, the method would return a part of of the fulfilled result
	 * @param user 
	 * @param type it could be:
	 *             <br> ScheduleType.ALL: return all Schedules.
	 *             <br> ScheduleType.GENERAL: return user created schedules
	 *             <br> ScheduleType.MERGED: return user merged schedules
	 *             <br> ScheduleType.SUBSCRIBED: return user subscribed schedules
	 * @param offset it's the number to skip. If offset = 0, the return object is start from the first object. 
	 *             <br> If offset =1, the return object is start from the second object.
	 * @param limit it's the maximum return size. If limit = 0, the method would return nothing.
	 * @return a list of schedule
	 */
	public List<Schedule> get(User user, ScheduleType type, int offset, int limit);
    /**
     * Count the number of the schedule by assigning the type of the user.
     * @param user
     * @param type it could be:
	 *             <br> ScheduleType.ALL: return all Schedules.
	 *             <br> ScheduleType.GENERAL: return user created schedules
	 *             <br> ScheduleType.MERGED: return user merged schedules
	 *             <br> ScheduleType.SUBSCRIBED: return user subscribed schedules
     * @return the number of the schedule by assigning the type of the user.
     */
	public int count(User user, ScheduleType type);
	/**
	 * Get a specific schedule which has the given schedule ID from the user 
	 * @param user
	 * @param scheduleID
	 * @return
	 */
	public Schedule get(User user, int scheduleID);
	/**
	 * Get the schedules which are fulfill with the given condition from whole database.
	 * By assigning offset and limit, the method would return a part of of the fulfilled result
	 * @param filters the search condition
	 * @param offset it's the number to skip. If offset = 0, the return object is start from the first object. 
	 *             <br> If offset =1, the return object is start from the second object.
	 * @param limit it's the maximum return size. If limit <0 , means no limitation.
	 * @return a list of schedule
	 */
	public List<Schedule> get(List<Filter> filters, int offest, int limit);
   
	/**
	 * Count the number of the schedules which are fulfill with the given conditions.
	 * @param filters the search condition
	 * @return The number of the schedules which are fulfill with the given conditions.
	 */
	public int count(List<Filter> filters);
	/**
	 * Remove the schedule from the database
	 * @param schedule
	 */
	public void delete(Schedule schedule);
	/**
	 * Add the event to the schedule. Then update the schedule at the database
	 * @param schedule
	 * @param event
	 */
	public void addEvent(Schedule schedule, Event event);
	/**
	 * Remove the event from the schedule. Then update the schedule at the database
	 * @param schedule
	 * @param event
	 */
	public void removeEvent(Schedule schedule, Event event);
}
